package inits

import (
	"fmt"
	"food-mgr/food-service/configs"
	"github.com/elastic/go-elasticsearch/v7"
)

func Es() {
	ESData := configs.Config.Es
	Address := ESData.Address
	cfg := elasticsearch.Config{
		Addresses: []string{
			Address,
		},
	}
	_, err = elasticsearch.NewClient(cfg)
	if err != nil {
		panic("es连接失败")
		return
	} else {
		fmt.Println("es连接成功")
	}
}